package pack2;

import java.util.Scanner;
public class java16 {
    public static void main(String[] arge){
        Scanner sc= new Scanner(System.in);
        String a[]=new String[20];
        int length[]=new int[20];
        int min,mini;
        int k = 0;
        for (int i = 0; i <20; i++) {
            if( (a[i]=sc.nextLine()).equals("#"))
                break;
            length[i]=a[i].length();
            }
        for (int i = 2; i < 11; i++)
            for (int j = 0; j <20; j++) {
                if(length[j]==i)
                    System.out.print(a[j]+" ");
            }



    }
}